package com.buanalintas.sandals.pos.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@Table(name = "pos_master_model")
//@NamedQueries({
//    @NamedQuery(name = "PosMasterModel.findAll", query = "SELECT t FROM PosMasterModel t"),
//    @NamedQuery(name = "PosMasterModel.findBySync", query = "SELECT t FROM PosMasterModel t WHERE t.sync = :sync"),
//    @NamedQuery(name = "PosMasterModel.findByModelId", query = "SELECT t FROM PosMasterModel t WHERE t.modelId = :modelId"),
//    @NamedQuery(name = "PosMasterModel.findByModelName", query = "SELECT t FROM PosMasterModel t WHERE t.modelName = :modelName")})
public class PosMasterModel implements Serializable {
    @OneToMany(mappedBy = "supplierModelModelId")
    private Collection<PosMasterSupplierModel> posMasterSupplierModelCollection;

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "model_id")
    private Integer modelId;
    @Column(name = "model_name")
    private String modelName;

    public PosMasterModel() {
    }

    public PosMasterModel(Integer modelId) {
        this.modelId = modelId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getModelId() {
        return modelId;
    }

    public void setModelId(Integer modelId) {
        this.modelId = modelId;
    }

    public String getModelName() {
        return modelName;
    }

    public void setModelName(String modelName) {
        this.modelName = modelName;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (modelId != null ? modelId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof PosMasterModel)) {
            return false;
        }
        PosMasterModel other = (PosMasterModel) object;
        if ((this.modelId == null && other.modelId != null) || (this.modelId != null && !this.modelId.equals(other.modelId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        // return "com.buanalintas.sandals.pos.entities.PosMasterModel[modelId=" + modelId + "]";
        return modelName;
    }

    @XmlTransient
    public Collection<PosMasterSupplierModel> getPosMasterSupplierModelCollection() {
        return posMasterSupplierModelCollection;
    }

    public void setPosMasterSupplierModelCollection(Collection<PosMasterSupplierModel> posMasterSupplierModelCollection) {
        this.posMasterSupplierModelCollection = posMasterSupplierModelCollection;
    }
}
